package com.yand.disk.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yand.disk.demo.dao.TDownLinkMapper;
import com.yand.disk.demo.entity.TDownLink;
import com.yand.disk.demo.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 链接的服务
 */
@Service
public class LinkServiceImpl implements LinkService {

    @Autowired
    private TDownLinkMapper linkMapper;

    /**
     * 查询链接列表
     * @param link
     * @return
     */
    @Override
    public PageInfo<TDownLink> queryLinkList(TDownLink link) {

        PageHelper.startPage(link.getPageNum(), link.getPageSize());

        return PageInfo.of(linkMapper.selectLinkList(link));
    }

    /**
     * 通过编码查询链接信息
     * @param link
     * @return
     */
    @Override
    public TDownLink queryLinkInfoByCode(TDownLink link) {
        return linkMapper.selectByPrimaryKey(link);
    }
}
